In [1]:
%matplotlib inline

from matplotlib import pyplot as plt
import matplotlib.mlab as mlab
import csv
from scipy.stats import norm
import numpy as np
import scipy.stats as stats
import numpy

In [2]:
data = open('../data/data.csv', 'r').readlines()
fieldnames = ['x', 'y', 'z', 'unmasked', 'synapses']
reader = csv.reader(data)
reader.next()

rows = [[int(col) for col in row] for row in reader]

In [6]:
sorted_x = sorted(list(set([r[0] for r in rows])))
sorted_y = sorted(list(set([r[1] for r in rows])))
sorted_z = sorted(list(set([r[2] for r in rows])))

x = list([r[0] for r in rows])
y = list([r[1] for r in rows])
z = list([r[2] for r in rows])

In [7]:
real_volume = numpy.zeros((len(sorted_x), len(sorted_y), len(sorted_z)))
for r in rows:
    real_volume[sorted_x.index(r[0]), sorted_y.index(r[1]), sorted_z.index(r[2])] = r[-1]

In [8]:
XYPlane = numpy.ndarray((len(x), len(y)))
XZPlane = numpy.ndarray((len(x), len(z)))
YZPlane = numpy.ndarray((len(Y), len(z)))

for row in rows:
    XYPlane[row[0], row[1]] += row[-1]
    XZPlane[row[0], row[2]] += row[-1]
    YYPlane[row[1], row[2]] += row[-1]

In [9]:
import scipy.signal as sig

In [ ]:
sig.correlate2d(XYPlane,XYPlane)

In [ ]:
sig.correlate2d(XZPlane,XZPlane)

In [ ]:
sig.correlate2d(YZPlane,YZPlane)

In [ ]:
for i in sorted_y:
    x = []
    z = []
    val = []

    for r in rows:
        if r[-2] != 0:
            if r[-1] !=0:
                if r[1] == i:
                    x.append(r[0])
                    z.append(r[2])
                    val.append(r[-1])
            
    plt.scatter(x,z,s = 50, c = val,norm=norm)
    plt.show()

In [ ]: